package com.itheima.stock.mapper;

import com.itheima.stock.pojo.domain.Stock4EvrDayDomain;
import com.itheima.stock.pojo.domain.Stock4MinuteDomain;
import com.itheima.stock.pojo.domain.StockUpdownDomain;
import com.itheima.stock.pojo.entity.StockRtInfo;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
* @author Administrator
* @description 针对表【stock_rt_info(个股详情信息表)】的数据库操作Mapper
* @createDate 2024-06-30 09:11:21
* @Entity com.itheima.stock.pojo.entity.StockRtInfo
*/
public interface StockRtInfoMapper {

    int deleteByPrimaryKey(Long id);

    int insert(StockRtInfo record);

    int insertSelective(StockRtInfo record);

    StockRtInfo selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(StockRtInfo record);

    int updateByPrimaryKey(StockRtInfo record);

    //查询指定时间股票数据集
    List<StockUpdownDomain> getStockInfoByTime(@Param("curDate") Date curDate);

    //查询指定时间股票数据集,不分页
    List<StockUpdownDomain> getStockInfoByTimeNopage(@Param("curDate") Date curDate);

    /**
     * 统计指定时间股票涨停 、跌停
     * @param startDate
     * @param endDate
     * @param flag
     * @return
     */
    List<Map> getStockUpDownCount(@Param("startDate") Date startDate, @Param("endDate") Date endDate, @Param("flag") int flag);


    /**
     * 统计指定时间下各个股票区间的数量
     * @param curdate
     * @return
     */
    List<Map> getIncreaseRangeInfoByDate(@Param("dateTime") Date curdate);


    /**
     * 获取T日分时数据
     *根据股票编码查询当天分时数据
     * @param stockCode
     */

     List<Stock4MinuteDomain> getStock4MinuteInfo(@Param("openDate") Date openDate, @Param("endDate") Date endDate, @Param("stockCode") String stockCode);


    /**
     * 根据股票code统计日k线
     *
     * @param startDate
     * @param endDate
     * @param stockCode
     * @return
     */
    List<Stock4EvrDayDomain> getStock4DKline(@Param("startDate") Date startDate, @Param("endDate") Date endDate, @Param("stockCode") String stockCode);

    //拆分sql1
    List<String> getTimeByRT(@Param("startDate") Date startDate, @Param("endDate") Date endDate, @Param("stockCode") String stockCode);

    //拆分sql2
    List<Stock4EvrDayDomain> get4DKLine(@Param("times") List<String> times, @Param("stockCode") String stockCode);


    /**
     * 批量插入个股
     * @param list
     * @return
     */
    int insertbacth(@Param("list") List<StockRtInfo> list);

}
